package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.RentalDeviceInventoryMapper;
import com.hello.system.domain.RentalDeviceInventory;
import com.hello.system.service.IRentalDeviceInventoryService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 设备库存Service业务层处理
 * 
 * @author hello
 * @date 2025-07-20
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class RentalDeviceInventoryServiceImpl extends ServiceImpl<RentalDeviceInventoryMapper, RentalDeviceInventory> implements IRentalDeviceInventoryService 
{
    private final RentalDeviceInventoryMapper rentalDeviceInventoryMapper;

    /**
     * 查询设备库存
     * 
     * @param inventoryId 设备库存主键
     * @return 设备库存
     */
    @Override
    public RentalDeviceInventory selectRentalDeviceInventoryByInventoryId(Long inventoryId)
    {
        return rentalDeviceInventoryMapper.selectRentalDeviceInventoryByInventoryId(inventoryId);
    }

    /**
     * 查询设备库存列表
     * 
     * @param rentalDeviceInventory 设备库存
     * @return 设备库存
     */
    @Override
    public List<RentalDeviceInventory> selectRentalDeviceInventoryList(RentalDeviceInventory rentalDeviceInventory)
    {
        return rentalDeviceInventoryMapper.selectRentalDeviceInventoryList(rentalDeviceInventory);
    }

    /**
     * 新增设备库存
     * 
     * @param rentalDeviceInventory 设备库存
     * @return 结果
     */
    @Override
    public int insertRentalDeviceInventory(RentalDeviceInventory rentalDeviceInventory)
    {
        rentalDeviceInventory.setCreateTime(DateUtils.getNowDate());
        return rentalDeviceInventoryMapper.insertRentalDeviceInventory(rentalDeviceInventory);
    }

    /**
     * 修改设备库存
     * 
     * @param rentalDeviceInventory 设备库存
     * @return 结果
     */
    @Override
    public int updateRentalDeviceInventory(RentalDeviceInventory rentalDeviceInventory)
    {
        rentalDeviceInventory.setUpdateTime(DateUtils.getNowDate());
        return rentalDeviceInventoryMapper.updateRentalDeviceInventory(rentalDeviceInventory);
    }


    /**
     * 批量删除设备库存
     * 
     * @param inventoryIds 需要删除的设备库存主键
     * @return 结果
     */
    @Override
    public int deleteRentalDeviceInventoryByInventoryIds(Long[] inventoryIds)
    {
        return rentalDeviceInventoryMapper.deleteRentalDeviceInventoryByInventoryIds(inventoryIds);
    }

    /**
     * 删除设备库存信息
     * 
     * @param inventoryId 设备库存主键
     * @return 结果
     */
    @Override
    public int deleteRentalDeviceInventoryByInventoryId(Long inventoryId)
    {
        return rentalDeviceInventoryMapper.deleteRentalDeviceInventoryByInventoryId(inventoryId);
    }
}
